from  machine import Pin,PWM
import time

ledD2 =PWM(Pin(2))
ledD2.freq(1000)

while True:
    for i in range(0,1024,1):
        ledD2.duty(i)
        time.sleep_ms(2)
        
    for i in range(1023,-1,-1):
        ledD2.duty(i)
        time.sleep_ms(2)
